package com.luhe.musicscore.symbol;

import com.luhe.musicscore.painter.Painter;
import com.luhe.musicscore.painter.localfont.LocalFontPainter;

import java.awt.*;
import java.io.FileInputStream;
import java.io.InputStream;

//符号父类，各种绘图符号
public class Symbol {

    //宽
    public int width;

    //高
    public int height;

    //横坐标
    public int x;

    //纵坐标
    public int y;

    //绘制边框
    static public boolean draw_border = false;



    //绘图对象
    Painter painter=new LocalFontPainter();


    //字体
    public static Font font1;

    static {
        try {
            InputStream inputStream = new FileInputStream("C:\\Users\\jme22\\IdeaProjects\\lumusic\\src\\com\\luhe\\staff\\akvo.ttf");
            font1 = Font.createFont(Font.PLAIN, inputStream);
            font1 = font1.deriveFont(java.awt.Font.PLAIN, 40);
            GraphicsEnvironment.getLocalGraphicsEnvironment().registerFont(font1);

        } catch (Exception e) {
            e.printStackTrace();
        }
    }

    public Symbol() {

    }

    //开始绘制符号
    public void paint(Graphics g) {

    }

    //绘制符号边框
    public void paintBorder(Graphics g) {
        if (draw_border) {
            g.setColor(Color.red);
            g.drawLine(x, y, x, y + height);
            g.drawLine(x, y, x + width, y);
            g.drawLine(x, y + height, x + width, y + height);
            g.drawLine(x + width, y, x + width, y + height);
        }
    }
}
